/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nl.biggrid.plier.opm;

import java.util.LinkedHashSet;
import javax.jdo.annotations.PersistenceCapable;
/**
 *
 * @author Souley
 */
@PersistenceCapable
public class Dependency implements java.io.Serializable {


    //--------------------------/
    //- Class/Member Variables -/
    //--------------------------/
    /**
     * Field effect.
     */
    private String effect;
    /**
     * Field cause.
     */
    private String cause;
    /**
     * Field graph.
     */
    private OPMGraph graph;
    /**
     * Field accounts.
     */
    private LinkedHashSet<Account> accounts;

    //----------------/
    //- Constructors -/
    //----------------/

    /**
     * Class constructor.
     */
    public Dependency() {
        super();
        accounts = new LinkedHashSet<Account>();
    }


    //-----------/
    //- Methods -/
    //-----------/
 
    /**
     * Returns the concrete causal relationship as a Used object. May be null!
     *
     * @return A Used object as the concrete dependency.
     */
    public String getEffect() {
        return this.effect;
    }

    /**
     * Sets the concrete causal relationship as a Used object.
     *
     * @param used the value to set.
     */
    public void setEffect(String anEffect) {
        this.effect = anEffect;
    }

    /**
     * Returns the concrete causal relationship as a Used object. May be null!
     *
     * @return A Used object as the concrete dependency.
     */
    public String getCause() {
        return this.cause;
    }

    /**
     * Sets the concrete causal relationship as a Used object.
     *
     * @param used the value to set.
     */
    public void setCause(String aCause) {
        this.cause = aCause;
    }

    /**
     * Sets the graph this dependency is part of.
     *
     * @param graph the graph this dependency is part of.
     */
    public void setGraph(OPMGraph graph) {
        this.graph = graph;
    }

    /**
     * Returns the graph this dependency is part of.
     *
     * @return the graph this dependency is part of.
     */
    public OPMGraph getGraph() {
        return graph;
    }

    /**
     * Returns the contents of the
     * collection in a Vector.
     *
     * @return this collection as a Vector
     */
    public LinkedHashSet<Account> getAccounts() {
        return this.accounts;
    }

     /**
     * Sets the account list from a vector.
     *
     * @param vRelatedAccountArray The vector to set the account list from.
     */
    public void setAccounts(
            final LinkedHashSet<Account> vRelatedAccountArray) {
        //-- copy array
        this.accounts.clear();
        this.accounts = vRelatedAccountArray;
    }
}
